<!--#include file="../nav/admin_top.php" -->  
<script type="text/javascript">
var url_save = '<?=url::build('admin_pen','add',array('reqtype'=>'json'))?>'; 
var url_return = '<?=url::build('admin_pen','index')?>';   
var pentypes = <?=json_encode($pentypes)?>;
$().ready(function(){  
	showLoading();   
  $('#title').focus();
	
	o2js.build('dates'); 
	o2js.build('jscalendar');  
	/* 定时日期选择 */
	Calendar.setup({
		inputField:'acdate',
		button:'slt_acdate',
		ifFormat:"%Y-%m-%d",
		singleClick:true
	});
	
	fnTypesChange();
}); 
/* 保存 */
function fnSave(){
	if($('#title').val() == ''){
		alert('请填写【标题】');
		$('#title').focus();
		return false;
	} 
	return true; 
} 


function fnTypesChange(){
	var id = $('#pentype_id').val();
	$('.typesinput').hide();

	switch(id){
		case "1":
			$('#typesinput_source').show();
			break
		case "2":
			$('#typesinput_logo').show();
			break
		case "3":
			$('#typesinput_logo').show();
			break
		case "4":
			$('#typesinput_logo').show();
			$('#typesinput_acdate').show();
			break
		default:
				
	}
	
	
}
</script>
<style type="text/css">
.typesinput{
display:none;
}

td.myinfo{
 
}
</style>	
<div class="titleDiv">
	<div class="titleCaption">
		<span class="captionSpan">信息维护 - 添加信息</span>
		<span class="totalSpan"> <label id="captionNum"></label> </span>
	</div>
</div> 　 
<form id="myform" action="" method="post" enctype="multipart/form-data"  onsubmit="return fnSave();" > 
  
<div class="blockdiv">
	<div class="titlediv">基本信息</div>
	<table class="mytable" >
		<tr>
			<td class="mylabel"><span class="red">*</span>类别：</td>
			<td class="myinfo" > 
				<select id="pentype_id" name="pentype_id" class="textBox" onchange="fnTypesChange()" > 
					<?PHP
					foreach($pentypes as $val){ 
						echo '<option value="'.$val['id'].'">'.$val['parentmap'].'</option>'; 
					}
					?> 
				</select>
			</td>  
		</tr>
		<tr>
			<td class="mylabel"><span class="red">*</span>标题：</td>
			<td class="myinfo" > 
				<input type="text" class="textBox" id="title" name="title" maxlength="100" style="width:80%" />
			</td>  
		</tr>

		<tbody class="typesinput" id="typesinput_source">
			<tr>
				<td class="mylabel">来源：</td>
				<td class="myinfo" > 
					<input type="text" class="textBox" id="source" name="source" maxlength="50" style="width:80%" />
				</td>  
			</tr>
		</tbody>
		<tbody class="typesinput" id="typesinput_logo">
			<tr>
				<td class="mylabel">宣传图：</td>
				<td class="myinfo" > 
					<input type="file" name="logo" />
					<div style="margin:5px auto;color:#FF6600">
						促销信息图片推荐高宽比：200*200大小
					</div>
					<div style="margin:5px auto;color:#FF6600">
						期刊杂志图片推荐高宽比：300*230大小
					</div>
					<div style="margin:5px auto;color:#FF6600">
						主题活动图片推荐高宽比：70*250大小
					</div>
				</td>  
			</tr>
		</tbody>
		<tbody class="typesinput" id="typesinput_acdate">
			<tr>
				<td class="mylabel">活动日期：</td>
				<td class="myinfo" > 
					<input type="text" class="textBox" id="acdate" name="acdate" value="{date('Y-m-d')}" readonly="readonly" maxlength="50" style="width:80" />
					<input type="button" class="btnicon_calendar" id="slt_acdate" />
				</td>  
			</tr>
		</tbody>
		<tr>
			<td class="mylabel">是否前台发布：</td>
			<td class="myinfo" >
				<select id="publishs" name="publishs" class="textBox">
					<option value="1">正常发布</option>
					<option value="0">暂停发布</option>
				</select>
			</td>  
		</tr> 
		<tr>
			<td class="mylabel">内容：</td>
			<td class="myinfo"  ><span class="gray">请尽量控制内容的宽度，前台显示会按照编辑器宽度进行显示</span>  </td>
		</tr>
		<tr>
			<td colspan="2"  > 
					<input type="hidden" id="content" name="content" value="" style="display:none" /> 
					<div>
						<iframe id="content___Frame" src="/fckeditor/editor/fckeditor.html?InstanceName=content&amp;Toolbar=Pen" width="100%" height="500" frameborder="0" scrolling="no"></iframe>
					</div>	 
			</td>  
		</tr> 
	</table> 
</div>
<div  class="button_div">
		<input type="submit" value="保 存" />
		<span class="gray">或</span> 
		<button class=" " onclick="jumpTo(url_return);return false;">返 回</button>
</div>  
</form>		
<!--#include file="../nav/admin_bottom.php" -->